package com.xigua.JucOfBeautiful.chapterOne.notifyAndWait1_3;

import com.sun.org.apache.xpath.internal.SourceTree;

/**
 * @author LiRongHua
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2022/1/2022:51
 */
public class WaitNotifyTest {

    static Object obj = new Object();

    public static void main(String[] args) throws InterruptedException {

        Thread threadA = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    System.out.println("---begin---");
                    synchronized (obj){
                        obj.wait();
                    }
                    System.out.println("---end---");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        threadA.start();
        Thread.sleep(1000);
        threadA.join();
        System.out.println("---begin interrup threadA---");
        threadA.interrupt();
        System.out.println("---end interrup threadA---");



    }
}
